<iframe th:replace="common/top.html" width="100%" frameborder="0" scrolling="yes" class="x-iframe"></iframe>
<link rel="StyleSheet" href="../css/item.css" type="text/css" media="screen"/>
<link rel="StyleSheet" href="../css/category.css" type="text/css" media="screen"/>
<div class="page-tips">商品管理</div>
<div id="Catalog">
    <!-- 覆盖层 -->
    <div class="login-bg"></div>
    <table>
        <tr>
            <td rowspan="7" th:utext="${product.description}"></td>
            <td><b th:text="${item.itemId}" id="itemId"></b></td>
        </tr>
        <tr>

        </tr>
        <tr>
            <td>
                <b>
                    <font size="4" th:text="${item.attribute1}+${(item.attribute2!=null)?item.attribute2:''}+${(item.attribute3!=null)?item.attribute3:''}+
          ${(item.attribute4!=null)?item.attribute4:''}+${(item.attribute5!=null)?item.attribute5:''}+${product.name}"> </font>
                </b>
            </td>
        </tr>
        <tr>
            <td th:text="${product.name}"></td>
        </tr>
        <tr>
            <td th:if="${item.amount<=0}" th:text="'Back ordered.'"></td>
            <td th:if="${item.amount>0}" th:text="${item.amount}+' in stock'"></td>
        </tr>

        <tr>
            <td th:with="num=${item.listPrice}" th:utext="${#numbers.formatCurrency(num)}">
            </td>
        </tr>

        <tr>
            <td class="editStock">
                <a href="javascript:;" class="Button append" id="appendBtn">增加库存</a>
                <a href="javascript:;" class="Button decrease" id="decreaseBt">减少库存</a>
                <a href="javascript:;" class="Button delete" id="deleteBtn">删除Item</a>
            </td>
        </tr>
    </table>
    <div>
        <a href="javascript:;" id="reviseItem">修改item具体信息</a>
    </div>
    <div class="edit_item_detail">
        <span class="close3">x</span>
        <div class="bar">请修改下面Item的信息</div>
        <form action="/catalog/reviseItem*" method="post">
            <ul class="detailList">
                <li class="item">itemid:<input name="itemId" type="text" class="itemid" th:value="${item.itemId}"></li>
                <li class="item">productid:<input name="productId" type="text" class="productid" readonly th:value="${product.productId}"></li>
                <li class="item">listprice:<input name="listPrice" type="text" class="listprice" th:value="${item.listPrice}"></li>
                <li class="item">unitcost:<input name="unitCost" type="text" class="unitcost" th:value="${item.unitCost}"></li>
                <li class="item">supplier:<input name="supplier" type="text" class="supplier" th:value="${item.supplierId}"></li>
                <li class="item">status:<input name="status" type="text" class="status" th:value="${item.status}"></li>
                <li class="item">attr1:<input name="attr1" type="text" class="attr1" th:value="${item.attribute1}"></li>
                <li class="item">attr2:<input name="attr2" type="text" class="attr2" th:value="${item.attribute2}"></li>
                <li class="item">attr3:<input name="attr3" type="text" class="attr3" th:value="${item.attribute3}"></li>
                <li class="item">attr4:<input name="attr4" type="text" class="attr4" th:value="${item.attribute4}"></li>
                <li class="item">attr5:<input name="attr5" type="text" class="attr5" th:value="${item.attribute5}"></li>
                <li class="item">attr5:<input name="amount" type="text" class="amount" th:value="${item.amount}"></li>
            </ul>

          <div class="button-container">
                  <button type="submit" id="add">确认修改</button>
                  <button type="button" id="cancel">取消</button>
          </div>
        </form>
    </div>

    <div id="pop-window">
        <div class="error-message" th:text="${errorMessage}"></div>

        <span class="close" id="close1">x</span>
        <div class="bar">请输入需要增加的数量</div>
            <table>
                <tr>
                    <th>当前库存</th>
                    <th>增加数量</th>
                    <th>最终库存</th>
                </tr>
                <tr>
                    <td id="current-surplus" th:text="${item.amount}"></td>
                    <td>
                        <div class="button-container">
                            <p>+</p><input type="text" value="0" id="operate-input">
                        </div>
                    </td>
                    <td id="result-surplus" th:text="${item.amount}"></td>
                </tr>
            </table>
        <div class="button-container">
        <a th:href="@{catalog/appendNum(itemId=${item.itemId})}" id="append-operate"><span class="isConfirm">Confirm</span></a>
<!--        <a th:href="@{catalog/decreaseNum(itemId=${item.itemId})}"  id="decrease-operate"><span class="isConfirm">Confirm</span></a>-->
        <a href="javascript:;"><span class="isConfirm cancel-operate1">Cancel</span></a>
        </div>
    </div>
    <div id="pop-window3">
        <span class="close" id="close2">x</span>
        <div class="bar">请输入需要减少的数量</div>
        <table>
            <tr>
                <th>当前库存</th>
                <th>减少数量</th>
                <th>最终库存</th>
            </tr>
            <tr>
                <td id="current-surplus2" th:text="${item.amount}"></td>
                <td>
                    <div class="button-container">
                        <p>-</p> <input type="text" value="0" id="operate-input2">
                    </div>

                </td>
                <td id="result-surplus2" th:text="${item.amount}"></td>
            </tr>
        </table>
<!--        <a th:href="@{catalog/appendNum(itemId=${item.itemId})}" id="append-operate"><span class="isConfirm">Confirm</span></a>-->
        <div class="button-container">
            <a th:href="@{catalog/decreaseNum(itemId=${item.itemId})}"  id="decrease-operate"><span class="isConfirm">Confirm</span></a>
            <a href="javascript:;"><span class="isConfirm cancel-operate1">Cancel</span></a>
        </div>

    </div>
    </div>
    <div id="pop-window2">
        <span class="close2">x</span>
        <div class="bar">确认永久删除该Item吗？</div>
        <div class="button-container">
            <a th:href="@{catalog/deleteItem(itemId=${item.itemId})}" id="delete-operate"><span class="isConfirm">确认</span></a>
            <a href="javascript:;"><span class="isConfirm cancel-operate2">取消</span></a>
        </div>

    </div>
    <script src="../js/item.js" type="text/javascript"></script>
</div>




<iframe th:replace="common/bottom.html" width="100%" frameborder="0" scrolling="yes" class="x-iframe"></iframe>
